package com.nxy.cpfsfe.busi.btmgtsk;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.adtec.starring.datapool.CompSDO;
import com.adtec.starring.datapool.EPOper;
import com.adtec.starring.pubmethod.Message;
import com.adtec.starring.struct.dta.DtaInfo;
import com.nxy.cpfsfe.PubBeanSerial;
import com.nxy.cpfsfe.exception.CpfsBizException;

public class TimerToTimerBean {
	private final static Logger LOGGER = LoggerFactory.getLogger(TimerToTimerBean.class);	

	public void getInfoFromSms(){
		LOGGER.info("---------定时器调用通用体系处理开始--------");	
		try {
			String tpId = DtaInfo.getInstance().getTpId();
			// 获取输入
			CompSDO inputSdo = (CompSDO) EPOper.getCompSDO(tpId, "ReqBody"); // 获取输入接口
			String bizMsg = (String) inputSdo.getValue("BizMsg")!=null?(String) inputSdo.getValue("BizMsg"):""; // 业务报文
			if(null !=bizMsg )
			LOGGER.debug("业务报文数据bizMsg:[{}]",bizMsg);
			EPOper.put(tpId, "ReqBean[0].head[0].servEcd","mQry_SeqSn");
//			EPOper.put(tpId, "ReqBean[0].head[0].initrSeqno","whj2019051712237aA1a5");
//			EPOper.put(tpId, "ReqBean[0].head[0].servInitrBrch","2200");
//			EPOper.put(tpId, "ReqBean[0].head[0].servInitrChanl","5");
			DtaInfo dtaInfo = DtaInfo.getInstance();
			Message msg = (Message) dtaInfo.getMessage();
			Map<String, Object> msgMap = new HashMap<String,Object>();
	        msgMap.put("seqNm", bizMsg);
	        msg.setBody(msgMap);
	    	String seqNo =PubBeanSerial.getInstance().getSeqNoAndIncrea(bizMsg);

			CompSDO outputSdo = EPOper.getCompSDO(tpId, "RspBody"); // 获取输出接口
			EPOper.put(tpId, "RspBean[0].head[0].rspsCd", CpfsBizException.SUCCESS_CODE);
			EPOper.put(tpId, "RspBean[0].head[0].respsInfoDesc","");
//			EPOper.put(tpId, "RspBean[0].body[0].BizMsg",seqNo);
			outputSdo.setValue("BizMsg", seqNo);
		} catch (Exception e) {
			LOGGER.error("定时器调用通用体系处理异常",e);
		}

		
	}

}
